﻿using Microsoft.AspNetCore.Mvc;
using System.Linq.Dynamic.Core;
using System.Threading.Tasks;
using System;
using WMS.BasicData.Vendors;
using WMS.OutboundManagement.ReturnAcceptances;
using Microsoft.AspNetCore.Mvc.RazorPages;
using System.Collections.Generic;

namespace WMS.Web.Controllers.OutboundManagement.ReturnAcceptances
{
    /// <summary>
    /// 退货控制器
    /// </summary>
    public class ReturnAcceptanceController : Controller
    {

        /// <summary>
        /// 供应商接口
        /// </summary>
        private readonly IReturnAcceptanceAppService _returnAcceptanceAppService;

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="returnAcceptanceAppService"></param>
        public ReturnAcceptanceController(IReturnAcceptanceAppService returnAcceptanceAppService)
        {
            _returnAcceptanceAppService = returnAcceptanceAppService;
        }


        /// <summary>
        /// 视图
        /// </summary>
        public IActionResult Index()
        {
            return View();
        }


        /// <summary>
        /// 退货入库（分页）
        /// </summary>
        /// <param name="page">页码</param>
        /// <param name="limit">页容量</param>
        /// <returns>返回对应数据</returns>
        /// Vendor/GetVendor
        [HttpGet]
        public async Task<JsonResult> GetReturnAcceptance(int page, int limit)
        {
            var pagedResult = await _returnAcceptanceAppService.GetReturnAcceptance(page, limit);
            return Json(new { data = pagedResult, code = 0 });
        }


        /// <summary>
        /// 修改状态
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public async Task<int> UpdateSdate(int id)
        {
            var i= await _returnAcceptanceAppService.UpdateSdate(id);
            return i;
        }


    }
}
